#ifndef SCREENS_H
#define SCREENS_H

#include <QtGui>

class Screen : public QGraphicsItem {
    public:
        Screen(QString id) : m_id(id), m_x(0), m_y(0), res(0) {}
        Screen(int width, int height, QString id)
            : m_id(id)
              , m_x(0)
              , m_y(0)
              , res(0)
        {
            resolutions.append(QSize(width,height));
        }
        //void draw(QGraphicsScene *scene);
        int width(){return resolutions[res].width();}
        int height(){return resolutions[res].height();}
        int x() const {return m_x;}
        void x(int value) {m_x=value;}
        int y() const {return m_y;}
        void y(int value) {m_y=value;}
        QString id(){return m_id;}
        void addResolution(int width, int height){
            resolutions.append(QSize(width,height));
        }
        void setResolution(QString res);
    public:
        QRectF boundingRect() const;
        void paint(QPainter *painter,
            const QStyleOptionGraphicsItem *option, QWidget *widget);
//        void mouseReleaseEvent ( QGraphicsSceneMouseEvent * event );
        void wheelEvent ( QGraphicsSceneWheelEvent * event );
    private:
        QVector<QSize> resolutions;

        QString m_id;
        int m_x, m_y;
        int res;
};

class Setup {
    typedef enum {
        Horizontal,
        Vertical
    } Orientation;
    public:
        Setup(QString id, int width, int heigth);
        ~Setup();
        void loadSetup(QString cfg);
        QString bestSetup();
        QString setup();
        void draw(QGraphicsScene *scene); 
        QString id(){return m_id;}
    private:
        QHash<QString,Screen *> screens;

        QString m_id;
        int m_width;
        int m_height;
        QGraphicsScene *m_scene;
        Orientation orientation;
};

#endif //< SCREENS_H
